package com.cty;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class regExpression07 {
    public static void main(String[] args) {
        //因为java默认是贪婪匹配，测试一下非贪婪匹配
        String content = "aaaa111111111111111111";
        String regStr = "\\d+?";//如果是\\d+这个是贪婪匹配，后面加个？表示是非贪婪匹配
        Pattern compile = Pattern.compile(regStr);
        Matcher matcher = compile.matcher(content);
        while (matcher.find()) {
            System.out.println("提取到：" + matcher.group(0));

        }
    }
}
